home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FishMarket 1.0
/
FishMarket v1.0.iso
/
fishies
/
526-550
/
disk_543
/
wbplane
/
includes
/
relmacros.i
< prev
Wrap
Text File
|
1992-05-06
|
6KB
|
329 lines
*»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
*»» Made for Hisoft Devpac 2.12 by Preben Nielsen
*»»
*»» 09-Aug-91: Made this header
*»»
*»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
*»» Some macros to help declare and use local and global stack
*»» variables. Includes a few macros to help passing arguments
*»» on stack (C style).
*»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
IFND REL_DEFINES
REL_DEFINES SET 1
* Syntax : dcByte name[,name[,name...]]
* Purpose: Allocate one or more bytes on stack
dcByte MACRO
dcSize set dcSize+1
\1 = -dcSize
IFNC '\2',''
dcByte \2,\3,\4,\5,\6,\7,\8
ENDC
ENDM
* Syntax : dcWord name[,name[,name...]]
* Purpose: Allocate one or more words on stack
dcWord MACRO
dcAlign2
dcSize set dcSize+2
\1 = -dcSize
IFNC '\2',''
dcWord \2,\3,\4,\5,\6,\7,\8
ENDC
ENDM
* Syntax : dcLong name[,name[,name...]]
* Purpose: Allocate one or more long-words on stack
dcLong MACRO
dcAlign2
dcSize set dcSize+4
\1 = -dcSize
IFNC '\2',''
dcLong \2,\3,\4,\5,\6,\7,\8
ENDC
ENDM
* Syntax : dcAPtr name[,name[,name...]]
* Purpose: Allocate one or more pointers on stack
dcAPtr MACRO
dcLong \1,\2,\3,\4,\5,\6,\7,\8
ENDM
* Syntax : dcArea name,size
* Purpose: Allocate a number of bytes on the stack
dcArea MACRO
dcSize set dcSize+\2
\1 = -dcSize
ENDM
* Syntax : dcAlias name[,name[,name...]]
* Purpose: To assign one or more names to the same address
dcAlias MACRO
\1 = -dcSize
IFNC '\2',''
dcAlias \2,\3,\4,\5,\6,\7,\8
ENDC
ENDM
* Syntax : dcAlign2
* Purpose: Align declaration address to a 2-byte boundary
dcAlign2 MACRO
dcSize set dcSize+(dcSize&1)
ENDM
* Syntax : dcDeclare A0|A1|A2|A3|A4|A5|A6
* Purpose: To initiate declaration of local variables/storage
dcDeclare MACRO
dcSize set 0
IFC '\1','A0'
dcReg set 0
ELSEIF
IFC '\1','A1'
dcReg set 1
ELSEIF
IFC '\1','A2'
dcReg set 2
ELSEIF
IFC '\1','A3'
dcReg set 3
ELSEIF
IFC '\1','A4'
dcReg set 4
ELSEIF
IFC '\1','A5'
dcReg set 5
ELSEIF
IFC '\1','A6'
dcReg set 6
ELSEIF
moveq #1234,D0
ENDC
ENDC
ENDC
ENDC
ENDC
ENDC
ENDC
ENDM
* Syntax : dcEnd
* Purpose: To end declaration of local variables/storage
dcEnd MACRO
dcAlign2
ENDM
* Syntax : dcAlloc
* Purpose: To allocate stackspace for local variables
dcAlloc MACRO
IFEQ dcReg
link A0,#-dcSize
ELSEIF
IFEQ dcReg-1
link A1,#-dcSize
ELSEIF
IFEQ dcReg-2
link A2,#-dcSize
ELSEIF
IFEQ dcReg-3
link A3,#-dcSize
ELSEIF
IFEQ dcReg-4
link A4,#-dcSize
ELSEIF
IFEQ dcReg-5
link A5,#-dcSize
ELSEIF
IFEQ dcReg-6
link A6,#-dcSize
ELSEIF
moveq #1234,D0
ENDC
ENDC
ENDC
ENDC
ENDC
ENDC
ENDC
ENDM
* Syntax : dcFree
* Purpose: To De-allocate stackspace for local variables
dcFree MACRO
IFEQ dcReg
unlk A0
ELSEIF
IFEQ dcReg-1
unlk A1
ELSEIF
IFEQ dcReg-2
unlk A2
ELSEIF
IFEQ dcReg-3
unlk A3
ELSEIF
IFEQ dcReg-4
unlk A4
ELSEIF
IFEQ dcReg-5
unlk A5
ELSEIF
IFEQ dcReg-6
unlk A6
ELSEIF
moveq #1234,D0
ENDC
ENDC
ENDC
ENDC
ENDC
ENDC
ENDC
ENDM
* Syntax : dcReset
* Purpose: To set all local variables/storage to 0
dcReset MACRO
IFEQ dcReg
movem.l D0/A0,-(SP)
IFLE dcSize-127
moveq #dcSize-1,D0
ELSEIF
move.w #dcSize-1,D0
ENDC
rClr.\@ clr.b -(A0)
dbf D0,rClr.\@
movem.l (SP)+,D0/A0
ELSEIF
IFEQ dcReg-1
movem.l D0/A1,-(SP)
IFLE dcSize-127
moveq #dcSize-1,D0
ELSEIF
move.w #dcSize-1,D0
ENDC
rClr.\@ clr.b -(A1)
dbf D0,rClr.\@
movem.l (SP)+,D0/A1
ELSEIF
IFEQ dcReg-2
movem.l D0/A2,-(SP)
IFLE dcSize-127
moveq #dcSize-1,D0
ELSEIF
move.w #dcSize-1,D0
ENDC
rClr.\@ clr.b -(A2)
dbf D0,rClr.\@
movem.l (SP)+,D0/A2
ELSEIF
IFEQ dcReg-3
movem.l D0/A3,-(SP)
IFLE dcSize-127
moveq #dcSize-1,D0
ELSEIF
move.w #dcSize-1,D0
ENDC
rClr.\@ clr.b -(A3)
dbf D0,rClr.\@
movem.l (SP)+,D0/A3
ELSEIF
IFEQ dcReg-4
movem.l D0/A4,-(SP)
IFLE dcSize-127
moveq #dcSize-1,D0
ELSEIF
move.w #dcSize-1,D0
ENDC
rClr.\@ clr.b -(A4)
dbf D0,rClr.\@
movem.l (SP)+,D0/A4
ELSEIF
IFEQ dcReg-5
movem.l D0/A5,-(SP)
IFLE dcSize-127
moveq #dcSize-1,D0
ELSEIF
move.w #dcSize-1,D0
ENDC
rClr.\@ clr.b -(A5)
dbf D0,rClr.\@
movem.l (SP)+,D0/A5
ELSEIF
IFEQ dcReg-6
movem.l D0/A6,-(SP)
IFLE dcSize-127
moveq #dcSize-1,D0
ELSEIF
move.w #dcSize-1,D0
ENDC
rClr.\@ clr.b -(A6)
dbf D0,rClr.\@
movem.l (SP)+,D0/A6
ELSEIF
moveq #1234,D0
ENDC
ENDC
ENDC
ENDC
ENDC
ENDC
ENDC
ENDM
* Syntax : parByte name[,name[,name...]]
* Purpose: Declare one or more bytes on the stack as parameters
ParByte MACRO
\1 = ParSize
ParSize set ParSize+1
IFNC '\2',''
ParByte \2,\3,\4,\5,\6,\7,\8
ENDC
ENDM
* Syntax : parWord name[,name[,name...]]
* Purpose: Declare one or more words on the stack as parameters
ParWord MACRO
\1 = ParSize
ParSize set ParSize+2
IFNC '\2',''
ParWord \2,\3,\4,\5,\6,\7,\8
ENDC
ENDM
* Syntax : parLong name[,name[,name...]]
* Purpose: Declare one or more long-words on the stack as parameters
ParLong MACRO
\1 = ParSize
ParSize set ParSize+4
IFNC '\2',''
ParLong \2,\3,\4,\5,\6,\7,\8
ENDC
ENDM
* Syntax : parAPtr name[,name[,name...]]
* Purpose: Declare one or more pointers on the stack as parameters
ParAPtr MACRO
ParLong \1,\2,\3,\4,\5,\6,\7,\8
ENDM
* Syntax : parArea name,size
* Purpose: Declare an area on the stack as a parameter
ParArea MACRO
\1 = ParSize
ParSize set ParSize+\2
ENDM
* Syntax : parDeclare
* Purpose: To initiate declaration of parameters
ParDeclare MACRO
ParSize set 8
ENDM
* Syntax : parEnd
* Purpose: To end declaration of parameters
ParEnd MACRO
ENDM
ENDC